<?php

namespace App\model;

use Encore\Admin\Traits\AdminBuilder;
use Encore\Admin\Traits\ModelTree;
use Illuminate\Database\Eloquent\Model;

/**
 * App\model\UserDepartment
 *
 * @property int $id
 * @property int|null $department_id
 * @property string|null $name
 * @property int|null $parent_id
 * @property int|null $order
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\UserDepartment newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\UserDepartment newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\UserDepartment query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\UserDepartment whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\UserDepartment whereDepartmentId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\UserDepartment whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\UserDepartment whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\UserDepartment whereOrder($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\UserDepartment whereParentId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\UserDepartment whereUpdatedAt($value)
 * @mixin \Eloquent
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\model\UserDepartment[] $children
 * @property-read int|null $children_count
 * @property-read \App\model\UserDepartment|null $parent
 */
class UserDepartment extends Model
{
    use ModelTree, AdminBuilder;
    protected $primaryKey='department_id';
    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);

        $this->setParentColumn('parent_id');
        $this->setOrderColumn('order');
        $this->setTitleColumn('name');
    }
    protected $table="user_department";
    protected $fillable=['deparment_id','name','parent_id','order'];


}
